Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! I wrote my solution focusing on the elevator demand, as other states are not relevant to the problem. I made two schemas for this solution:
Elevator
Represents an elevator in the system:
id: Unique identifierbuilding_id: Identifier for the buildingmax_floor: Maximum floor the elevator can reachmin_floor: Minimum floor the elevator can reachElevatorDemand
Represents a demand for an elevator:
id: Unique identifiertimestamp: When the demand occurredfloor: Which floor the demand came fromdirection: Whether the person wanted to go up or downelevator_id: Which elevator responded to this demand (optional)The application was written in Python using FastAPI and SQLAlchemy for the DB, FastAPI was my first choice because it's a extremely powerful framework that not only is fast but it allows for fast development thanks to Pydantic you get validation, serialization, docs, etc out of the box. The entire web app is in a Docker file and uses Alembic for migrations. Also (with the help of AI) wrote some tests using Pytest with mocks. As with any FastAPI application, you can see the entire API docs in http://localhost:8000/docs . You run the server with the docker_run.bat or .sh script in the scripts folder.
Check documentation.md for setup instructions and more details. If you have any questions please let me know